package com.fare.taluo.fetl.domain.entity;

import java.util.Date;
import java.util.List;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.OneToOne;
import javax.persistence.Table;

import com.dayatang.domain.InstanceFactory;
import com.fare.taluo.fetl.domain.base.BaseFetlEntity;
import com.fare.taluo.fetl.domain.repository.IDoublePlaneInfoRepository;

@Entity
@Table(name="planeinfo_double")
public class DoublePlaneInfoEntity extends BaseFetlEntity{
	
	
	/**
	 * 
	 */
	private static final long serialVersionUID = 8972760603185080020L;

	@Id
	@GeneratedValue(strategy = GenerationType.AUTO)
	private Long id;
	
	/**
	 * 外键，对应表CRAWL_PF_SOURCE_DATA的rowkey 源网页数据rowKey
	 * 
	 */
	
	@Column(name="SOURCE_ROWKEY")
	private String sourceRowkey;

	/**
	 * 渠道的hbasekey
	 */
	
	@Column(name="ATTACH_HBASE_KEY")
	private String attachHbaseKey;
	/**
	 * 创建时间
	 */
	@Column(name="CREATE_TIME")
	private Date createTime = new Date();
	/**
	 * 航班的抓取时间
	 */
	@Column(name="GRAB_DATE")
	private Date grabDate = new Date();
	/**
	 * 抓取渠道ID
	 * */
	@Column(name="GRAB_CHANNEL_ID")
	private Long grabChannelId;
	/**
	 * 抓取渠道名称
	 */
	@Column(name="GRAB_CHANNEL_NAME")
	private String grabChannelName;
	/**
	 * 运营商简称英文，如：MU
	 */
	@Column(name="CARRIER_KEY")
	private String carrierKey;

	/**
	 * 运营商简称中文，如：南航
	 */
	@Column(name="CARRIER_NAME")
	private String carrierName;

	/**
	 * 运营商全名，如：中国海南航空公司
	 */
	@Column(name="CARRIER_FULL_NAME")
	private String carrierFullName;
	/**
	 * 航班号，如： MU3540
	 */
	@Column(name="FLIGHTNO")
	private String flightNo;

	/**
	 * 实际乘坐航班号，如 SC1234 实际乘坐CZ1234
	 */
	@Column(name="ACTUALLY_FLIGHT_NO")
	private String actuallyFlightNo;

	/**
	 * 飞机类型
	 */
	@Column(name="FLIGHT_TYPE")
	private String flightType;
	/**
	 * 航班批次日期。如:2012-05-19,格式:yyyy-MM-dd
	 */
	@Column(name="FLIGHT_DATE")
	private String flightDate;

	/**
	 * 航班起飞时间
	 */
	@Column(name="START_TIME")
	private Date startTime;

	/**
	 * 航班预计到达时间
	 */
	@Column(name="END_TIME")
	private Date endTime;
	/**
	 * 起飞城市三字码（是城市，不是机场三字码）
	 * 
	 */
	@Column(name="FROM_CITY")
	private String fromCity;
	/**
	 * 起飞城市名称
	 * 
	 */
	@Column(name="FROM_CITY_NAME")
	private String fromCityName;
	/**
	 * 目的城市三字码三字码
	 */
	@Column(name="TO_CITY")
	private String toCity;
	/**
	 * 目的城市名称
	 */
	@Column(name="TO_CITY_NAME")
	private String toCityName;
	/**
	 * 区域码
	 */
	@Column(name="AREA_CODE")
	private String areaCode;
	/**
	 * 区域名称
	 */
	@Column(name="AREA_NAME")
	private String areaName;

	/**
	 * 全程最低裸价（单程的全程最低价格，或者往返的来回打包最低价格）
	 */
	@Column(name="TOTAL_LOWEST_PRICE")
	private Double totalLowestPrice;

	/**
	 * 全程最高裸价
	 */
	@Column(name="TOTAL_HIGHEST_PRICE")
	private Double totalHighestPrice;

	/**
	 * 全程最低裸价代理提供商名称
	 */
	@Column(name="AGENT_NAME")
	private String agentName;
	
	/**
	 * 返程日期
	 */
	@Column(name="RETURN_FLIGHT_DATE")
	private String returnFlightDate;
	
	@OneToOne
	@JoinColumn(name="DOUBLE_JSON_ID")
	private DoublePlanInfoJsonEntity doublePlanInfoJsonEntity;
	
/*	//中转的实体set
	private Set<TransitEntity> transits = new HashSet<TransitEntity>();
	
	//仓位信息
	private Set<CabinEntity> cabins = new HashSet<CabinEntity>();
	
	
	//代理信息
	private Set<AgentEntity> agents = new HashSet<AgentEntity>();
	
	//经停信息
	private Set<StopOverEntity> stopOvers = new HashSet<StopOverEntity>();*/
	
	

	public Long getId() {
		return id;
	}

	public void setId(Long id) {
		this.id = id;
	}

	public String getSourceRowkey() {
		return sourceRowkey;
	}

	public void setSourceRowkey(String sourceRowkey) {
		this.sourceRowkey = sourceRowkey;
	}

	public String getAttachHbaseKey() {
		return attachHbaseKey;
	}

	public void setAttachHbaseKey(String attachHbaseKey) {
		this.attachHbaseKey = attachHbaseKey;
	}

	public Date getCreateTime() {
		return createTime;
	}

	public void setCreateTime(Date createTime) {
		this.createTime = createTime;
	}

	public Long getGrabChannelId() {
		return grabChannelId;
	}

	public void setGrabChannelId(Long grabChannelId) {
		this.grabChannelId = grabChannelId;
	}

	public String getGrabChannelName() {
		return grabChannelName;
	}

	public void setGrabChannelName(String grabChannelName) {
		this.grabChannelName = grabChannelName;
	}

	public String getCarrierKey() {
		return carrierKey;
	}

	public void setCarrierKey(String carrierKey) {
		this.carrierKey = carrierKey;
	}

	public String getCarrierName() {
		return carrierName;
	}

	public void setCarrierName(String carrierName) {
		this.carrierName = carrierName;
	}

	public String getCarrierFullName() {
		return carrierFullName;
	}

	public void setCarrierFullName(String carrierFullName) {
		this.carrierFullName = carrierFullName;
	}

	public String getFlightNo() {
		return flightNo;
	}

	public void setFlightNo(String flightNo) {
		this.flightNo = flightNo;
	}

	public String getActuallyFlightNo() {
		return actuallyFlightNo;
	}

	public void setActuallyFlightNo(String actuallyFlightNo) {
		this.actuallyFlightNo = actuallyFlightNo;
	}

	public String getFlightType() {
		return flightType;
	}

	public void setFlightType(String flightType) {
		this.flightType = flightType;
	}

	public String getFlightDate() {
		return flightDate;
	}

	public void setFlightDate(String flightDate) {
		this.flightDate = flightDate;
	}

	public Date getStartTime() {
		return startTime;
	}

	public void setStartTime(Date startTime) {
		this.startTime = startTime;
	}

	public Date getEndTime() {
		return endTime;
	}

	public void setEndTime(Date endTime) {
		this.endTime = endTime;
	}

	public String getFromCity() {
		return fromCity;
	}

	public void setFromCity(String fromCity) {
		this.fromCity = fromCity;
	}

	public String getFromCityName() {
		return fromCityName;
	}

	public void setFromCityName(String fromCityName) {
		this.fromCityName = fromCityName;
	}

	public String getToCity() {
		return toCity;
	}

	public void setToCity(String toCity) {
		this.toCity = toCity;
	}

	public String getToCityName() {
		return toCityName;
	}

	public void setToCityName(String toCityName) {
		this.toCityName = toCityName;
	}

	public String getAreaCode() {
		return areaCode;
	}

	public void setAreaCode(String areaCode) {
		this.areaCode = areaCode;
	}

	public String getAreaName() {
		return areaName;
	}

	public void setAreaName(String areaName) {
		this.areaName = areaName;
	}

	public Double getTotalLowestPrice() {
		return totalLowestPrice;
	}

	public void setTotalLowestPrice(Double totalLowestPrice) {
		this.totalLowestPrice = totalLowestPrice;
	}

	public Double getTotalHighestPrice() {
		return totalHighestPrice;
	}

	public void setTotalHighestPrice(Double totalHighestPrice) {
		this.totalHighestPrice = totalHighestPrice;
	}

	public String getAgentName() {
		return agentName;
	}

	public void setAgentName(String agentName) {
		this.agentName = agentName;
	}

	public String getReturnFlightDate() {
		return returnFlightDate;
	}

	public void setReturnFlightDate(String returnFlightDate) {
		this.returnFlightDate = returnFlightDate;
	}

	public DoublePlanInfoJsonEntity getDoublePlanInfoJsonEntity() {
		return doublePlanInfoJsonEntity;
	}

	public void setDoublePlanInfoJsonEntity(
			DoublePlanInfoJsonEntity doublePlanInfoJsonEntity) {
		this.doublePlanInfoJsonEntity = doublePlanInfoJsonEntity;
	}
	
	public IDoublePlaneInfoRepository getIDoublePlaneInfoRepository(){
		return InstanceFactory.getInstance(IDoublePlaneInfoRepository.class);
	}
	
	/**
	 * 查询往返
	 * @param hbaseKey  20005
	 * @param fromCity  PEK
	 * @param toCity    CAN
	 * @param flightBatchDate '2014-03-13'
	 * @param returnFlightDate '2014-04-13'
	 * @param flightNo 'CA1321'
	 * @return
	 */
	public List<DoublePlaneInfoEntity> findPlaneInfoProperty(String hbaseKey,
			String fromCity, String toCity, String flightBatchDate,
			String returnFlightDate, String flightNo) {
		return getIDoublePlaneInfoRepository().findPlaneInfoProperty(hbaseKey, fromCity, toCity, flightBatchDate, returnFlightDate, flightNo);
	}

	public Date getGrabDate() {
		return grabDate;
	}

	public void setGrabDate(Date grabDate) {
		this.grabDate = grabDate;
	}
	
}
